import http from "@/utils/http";
import { AxiosRequestConfig } from "axios";

export interface GetDerivedMetrics_ {
  /**
   * @description 平台id
   * @format int32
   * @example 1
   */
  appId?: number;
  /**
   * @description 报表id
   * @format int32
   * @example 1
   */
  reportId?: number;
}

export class MetricsReportRel {
  /**
   * 指标和报表绑定关系记录
   *
   * @tags 指标和报表绑定关系记录
   * @request POST: /report/bind
   * @secure
   */
  postBind = (body: defs.MetricsReportRelDTO, params: AxiosRequestConfig = {}) =>
    http.request<defs.ResponseEntityListMetricsReportRelVO>({
      url: `/report/bind`,
      method: "POST",
      data: body,
      ...params,
    });

  /**
   * 通过报表id和appId查询关联派生指标信息
   *
   * @tags 指标和报表绑定关系记录
   * @request GET: /report/derived-metrics
   * @secure
   */
  getDerivedMetrics = (
    query: { appId?: number; reportId?: number } | GetDerivedMetrics_,
    params: AxiosRequestConfig = {},
  ) =>
    http.request<defs.ResponseEntityListExposeMetricsVO>({
      url: `/report/derived-metrics`,
      method: "GET",
      params: query,
      ...params,
    });
}

export default new MetricsReportRel();
